<div id="contact-page" class="container">
    <div class="row">
        <div class="col-sm-8">
            <div class="contact-form">
                <h2 class="title text-center">Danh sách order của bạn</h2>
                <table class="table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>Số order</th>
                        <th>Thời gian đặt</th>
                        <th>Giá trị đơn hàng</th>
                        <th>Trạng thái</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php
                    if (empty($Orders) && empty($preOrders)) : ?>
                        <tr>
                            <td colspan="5">Không có đơn hàng nào</td>
                        </tr>
                    <?php endif; ?>
                    <?php
                    if (!empty($Orders)) : ?>
                        <tr>
                            <td colspan="5">Order hàng có sẵn</td>
                        </tr>
                        <?php foreach ($Orders as $key => $val) : ?>
                            <tr>
                                <td><?php echo $val->order_number; ?></td>
                                <td><?php echo date('m/d/y h:i a', strtotime($val->ordered_on)); ?></td>
                                <td><?php echo format_currency($val->total); ?></td>
                                <td><?php echo $val->status; ?></td>
                                <td>
                                    <a href="<?php echo site_url('secure/order_detail/') . '/' . $val->order_number; ?>">Chi
                                        tiết</a></td>
                            </tr>
                        <?php endforeach; // end foreach downloads ?>
                    <?php else: ?>
                        <tr>
                            <td colspan="5">Không có đơn hàng nào</td>
                        </tr>
                    <?php endif; ?><?php
                    if (!empty($preOrders)) : ?>
                        <tr>
                            <td colspan="5">Order hàng không có sẵn</td>
                        </tr>
                        <?php foreach ($preOrders as $key => $val) : ?>
                            <tr>
                                <td><?php echo $val->custom_order_number; ?></td>
                                <td><?php echo date('m/d/y h:i a', strtotime($val->datetime)); ?></td>
                                <td><?php echo format_currency($val->total); ?></td>
                                <td><?php echo $val->status; ?></td>
                                <td>
                                    <a href="<?php echo site_url('uploads/custom_orders/') . '/' . $val->content; ?>">Xem lại đơn hàng</a>
                                </td>
                            </tr>
                        <?php endforeach; // end foreach downloads ?>
                    <?php else: ?>
                        <div class="alert">
                            <?php echo lang('no_downloads'); ?>
                        </div>
                    <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
